/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package codegen.graphnetwork.nodes.operartion

import codegen.graphnetwork.model.Value
/**
 *
 * @author hungcuong
 */
public class OpAdd {
    Node parent;
    public OpAdd(Node parent) {
        this.parent = parent;
    }
    
    public void doOperation(Value[] inputs,Value[] outputs){
        float r = 0;
        for (Value v : inputs) {
            r += v.value;
        }
        outputs[0].value=r;
    }
    
    public String getOperationSyntax(Value[] inputs,Value output){
        String str;
        for (Value v : inputs){
            str += (parent.getNamedValue(v) +"+");
        }
        str = parent.getNamedValue(output) +"="+str;
        return str;
    }
}


